package com.ningxun.rms.web.controller.signup;

import java.util.List;

import com.ningxun.rms.signup.domain.BusSignup;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ningxun.rms.common.annotation.Log;
import com.ningxun.rms.common.core.controller.BaseController;
import com.ningxun.rms.common.core.domain.AjaxResult;
import com.ningxun.rms.common.enums.BusinessType;
import com.ningxun.rms.signup.domain.BusSignupApprove;
import com.ningxun.rms.signup.service.IBusSignupApproveService;
import com.ningxun.rms.common.core.page.TableDataInfo;

/**
 * 企业审核Controller
 *
 * @author rms
 * @date 2025-07-15
 */
@RestController
@RequestMapping("/signup/approve")
public class BusSignupApproveController extends BaseController
{
    @Autowired
    private IBusSignupApproveService busSignupApproveService;

    /**
     * 查询企业审核列表
     */
    @PreAuthorize("@ss.hasPermi('signup:approve:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusSignup busSignup)
    {
        startPage();
        List<BusSignup> list = busSignupApproveService.selectBusSignupApproveList(busSignup);
        return getDataTable(list);
    }


    /**
     * 获取企业审核详细信息
     */
    @PreAuthorize("@ss.hasPermi('signup:approve:query')")
    @GetMapping(value = "/{signupId}")
    public AjaxResult getInfo(@PathVariable("signupId") Long signupId)
    {
        return success(busSignupApproveService.selectBusSignupApproveBySignupId(signupId));
    }

    /**
     * 新增企业审核
     */
    @PreAuthorize("@ss.hasPermi('signup:approve:add')")
    @Log(title = "企业审核", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusSignupApprove busSignupApprove)
    {
        return toAjax(busSignupApproveService.insertBusSignupApprove(busSignupApprove));
    }

    /**
     * 修改企业审核
     */
    @PreAuthorize("@ss.hasPermi('signup:approve:edit')")
    @Log(title = "企业审核", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusSignupApprove busSignupApprove)
    {
        return toAjax(busSignupApproveService.updateBusSignupApprove(busSignupApprove));
    }

    /**
     * 删除企业审核
     */
    @PreAuthorize("@ss.hasPermi('signup:approve:remove')")
    @Log(title = "企业审核", businessType = BusinessType.DELETE)
    @DeleteMapping("/{approveIds}")
    public AjaxResult remove(@PathVariable Long[] approveIds)
    {
        return toAjax(busSignupApproveService.deleteBusSignupApproveByApproveIds(approveIds));
    }

}
